package com.skyworth.web.admin.store.repository;

import com.skyworth.web.admin.store.model.StoreModel;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by lxs on 2016/8/19.
 */
public interface StoreRepository extends PagingAndSortingRepository<StoreModel, Long> {

	@Transactional
	@Modifying
	@Query("update StoreModel m set m.removeFlag = 1 where m.id = ?1")
	public void LogicDel(long id);

	@Query("select ss from StoreModel ss where ss.companyId=?1")
	Page<StoreModel> findByComapnyId(long companyId, Pageable pageable);
}
